package cn.topevery.garden.entity.po.event;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.hutool.core.bean.BeanUtil;
import cn.topevery.garden.framework.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import hw.topevery.framework.annotation.DbTable;
import hw.topevery.framework.annotation.DbTableField;
import hw.topevery.framework.enums.DbTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author 陈勇
 * @date 2021/04/09
 **/
@ApiModel(value = "EventUrgency", description = "案件关联督办催办信息")
@DbTable(tableName = "t_event_urgency")
@Data
public class EventUrgency extends BaseEntity {

    @ApiModelProperty(value = "Id")
    @DbTableField(columnName = "c_urgency_id", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    public String urgencyId;
    @ApiModelProperty(value = "案件Id")
    @DbTableField(columnName = "c_evt_id", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    public String evtId;
    @ApiModelProperty(value = "类型： 0催办 1督办")
    @DbTableField(columnName = "c_type", dbType = DbTypeEnum.INTEGER, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "级别", orderNum = "5", replace = {"一级督办_1", "二级督办_2", "三级督办_3"})
    public Integer type;

    @ApiModelProperty(value = "催督办人员ID")
    @DbTableField(columnName = "c_urgency_user_id", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    public String urgencyUserId;

    @ApiModelProperty(value = "催督办人员")
    @DbTableField(columnName = "c_urgency_user_name", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "催督办人", orderNum = "6", mergeVertical = true)
    public String urgencyUserName;

    @ApiModelProperty(value = "工作流环节实例Id")
    @DbTableField(columnName = "c_wf_act_inst_id", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    public String wfActInstId;
    @ApiModelProperty(value = "督办对象ID")
    @DbTableField(columnName = "c_receive_object_id", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    public String receiveObjectId;
    @ApiModelProperty(value = "督办对象类型：用户 100601, 角色 100602, 部门 100603, 其它100604,")
    @DbTableField(columnName = "c_receive_type_id", dbType = DbTypeEnum.INTEGER, isKey = false, canUpdate = true, canInsert = true)
    public Integer receiveTypeId;
    @ApiModelProperty(value = "督办对象名称")
    @DbTableField(columnName = "c_receive_object_name", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    public String receiveObjectName;
    @ApiModelProperty(value = "描述")
    @DbTableField(columnName = "c_desc", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "催督办意见", orderNum = "10")
    public String desc;
    @ApiModelProperty(value = "是否通知被督办、催办环节的办理人 0否 1是")
    @DbTableField(columnName = "c_is_notify", dbType = DbTypeEnum.INTEGER, isKey = false, canUpdate = true, canInsert = true)
    public Integer isNotify;
    @ApiModelProperty(value = "是否监控被催办或者督办的案件环节状态变化 0否 1是")
    @DbTableField(columnName = "c_is_listen", dbType = DbTypeEnum.INTEGER, isKey = false, canUpdate = true, canInsert = true)
    public Integer isListen;

    // 案件信息冗余
    @ApiModelProperty("案件号")
    @DbTableField(columnName = "c_event_code", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "案件号", orderNum = "0", mergeVertical = true)
    private String code;

    @ApiModelProperty(value = "上报时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DbTableField(columnName = "c_report_date", dbType = DbTypeEnum.TIMESTAMP, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "上报时间", orderNum = "1", format = "yyyy-MM-dd HH:mm:ss", mergeVertical = true)
    private LocalDateTime reportDate;

    @ApiModelProperty(value = "上报人ID")
    @DbTableField(columnName = "c_report_id", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    private String reportId;

    @ApiModelProperty(value = "上报人")
    @DbTableField(columnName = "c_report_name", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "上报人", orderNum = "2", mergeVertical = true)
    private String reportName;

    @ApiModelProperty(value = "催督办时责任单位ID(案件最终处理企业ID/责任单位ID)")
    @DbTableField(columnName = "c_last_dept_id", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    private String lastDeptId;

    @ApiModelProperty("责任单位")
    @DbTableField(columnName = "c_dept_name", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "责任单位", orderNum = "3", mergeVertical = true)
    private String deptName;

    @ApiModelProperty("责任人")
    @DbTableField(columnName = "c_person_name", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    private String personName;

    @ApiModelProperty(value = "催督办时行业类型名称")
    @DbTableField(columnName = "c_industry_name", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "行业类型", orderNum = "4", mergeVertical = true)
    private String industryName;

    @ApiModelProperty(value = "催督办时环节名称ID")
    @DbTableField(columnName = "c_cur_act_id", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    private String curActId;

    @ApiModelProperty(value = "催督办时环节名称")
    @DbTableField(columnName = "c_cur_act_name", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "催督办时环节", orderNum = "7", mergeVertical = true)
    private String curActName;

    @ApiModelProperty(value = "催督办时来件时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DbTableField(columnName = "c_in_date", dbType = DbTypeEnum.TIMESTAMP, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "来件时间", orderNum = "8", format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime inDate;

    @ApiModelProperty(value = "案催督办时件地址")
    @DbTableField(columnName = "c_address", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "地址", orderNum = "9")
    private String address;

    @ApiModelProperty(value = "催督办时剩余时间: 单位秒")
    @DbTableField(columnName = "c_last_minutes", dbType = DbTypeEnum.VARCHAR, isKey = false, canUpdate = true, canInsert = true)
    @Excel(name = "超时时间", orderNum = "5")
    private String lastMinutes;

    public EventUrgency copyFrom(Object from) {
        BeanUtil.copyProperties(from, this, new String[0]);
        return this;
    }
}
